package oldmodifiers;

import java.util.List;

import inputs.Input;

public class Modifier extends Input{
	protected int value;
	protected List<Input> inputs;
	private Modifiers type;
	private ModifierData prevData;
	
	protected Modifier()
	{
		super();
		type = null;
		prevData = new ModifierData(0, false);
	}
	
	public Modifier(List<Input> inputs, Modifiers type)
	{
		super();
		this.inputs = inputs;
		this.type = type;
		prevData = new ModifierData(0, false);
		AccountForInputs();
	}
	
	public Modifier(List<Input> inputs, Modifiers type, int min, int max)
	{
		super(min, max);
		this.inputs = inputs;
		this.type = type;
		prevData = new ModifierData(0, false);
		AccountForInputs();
	}
	
	protected void Update()
	{
		this.prevData = this.type.Update(inputs, prevData);
		UpdateValues();
	}
	
	protected void AccountForInputs()
	{
		prevData = this.type.AccountForInputs(inputs, prevData);
		UpdateValues();
	}
	
	private void UpdateValues()
	{
		this.value = prevData.getValue();
		this.min = prevData.getMin();
		this.max = prevData.getMax();
	}
	
	public final int getValue() {
		return this.value;
	}
	
	public boolean getRun()
	{
		return this.prevData.getRun();
	}
	
	public void setRun(boolean run)
	{
		this.prevData.setRun(run);
	}
}
